<?php
$rs= getRelatedPages($row_rs_up['content_id']);
$rt =mysql_fetch_assoc($rs);
echo "<strong class='redtxt'>".mysql_num_rows($rs)." Related Pages</strong>";
if(mysql_num_rows($rs) >0){
?>

<div id="pg_action"></div>
<table width="98%" border="0" cellspacing="0" cellpadding="4" style="margin:5px" id="datatable" class="allround">
 
 <?php do {
	  $p =$rt['primary_page'];
	 if($p==$row_rs_up['content_id']) $p = $rt['secondary_page'];
	 $rdata = getContentDetails($p);
	 $rowdata = mysql_fetch_assoc($rdata);
	  ?>
  <tr>
    <td><a href="?page=content&itemid=<?php echo $p; ?>">1<?php echo  $rowdata["page_title"];?></a></td>
    <td><input type="button" name="button" id="del<?php echo $p; ?>" value="remove page" class="btn" onclick="processResourceDeleteClick('del<?php echo $p; ?>',<?php echo $rt['secondary_page']; ?>,<?php echo $rt['primary_page']; ?>,'rp','pg_action');">
    </td>
  </tr>
  <?php }while($rt =mysql_fetch_assoc($rs));?>
</table>
<?php } ?>